<template>
  <div class="box-item" :style="{ padding }">
    <div class="box-item__title">
      <i v-if="icon" class="icon"></i>
      <span v-if="title">{{ title }}</span>
    </div>
    <slot></slot>
  </div>
</template>

<script>
  export default {
    components: {},
    props: {
      title: {
        type: String,
        default: '',
      },
      icon: {
        type: String,
        default: '',
      },
      padding: {
        type: String,
        default: '20px',
      },
    },
    data() {
      return {}
    },
  }
</script>

<style lang="scss" scoped>
  .box-item {
    position: relative;
    padding: 20px;
    margin-top: 20px;
    border: 1px solid #ebeef5;
    border-radius: 4px;

    &__title {
      position: absolute;
      top: -18px;
      left: 18px;
      padding: 0 10px;
      background: #fff;
      i {
        padding-right: 10px;
      }
      span {
        font-weight: bold;
        color: #999;
      }
    }
  }
</style>
